<template>
  <header>
    <button class="back" @click="goback"></button>
      <h2>{{getTitle}}</h2>
    <button class="about"></button>
  </header>
</template>
 <script>
 export default {
   name: 'header',
   data(){
      return {
        title: this.$route.name
      }
   },
   methods: {
     goback(){
       this.$router.go(-1);
     }
   },
   computed: {
     getTitle(){
       let tltle = '你所访问的内容不存在';
       switch (this.$route.name) {
          case 'Home':
            tltle = '游戏首页';
            break;
          case 'Hello':
            tltle = 'Hello there';
            break;
          case 'Setting':
            tltle = '人数设置';
            break;
          case 'Deal':
            tltle = '查看身份';
            break;
       }
       return tltle;
     }
   }
 }
 </script>
 